package com.brillilab.service.module.message.template.impl.plan;

import com.alibaba.fastjson.JSONObject;
import com.brillilab.service.module.message.template.AbstractMessageTemplate;
import com.brillilab.service.module.message.template.enums.MessageTypeEnum;
import lombok.Data;

/**
 * @author zlb
 * @Title: ManagerRemovePlanTemplate
 * @ProjectName brill_lab
 * @Description: TODO
 * @date 2019/11/6 16:00
 */
@Data
public class ManagerRemovePlanTemplate extends AbstractMessageTemplate {
    private String experimentTargetName;
    private String operatorName;

    /**
     * 同一个实验流的成员将实验流加入了计划
     *
     * @param labId                实验室ID
     * @param executorUid          接收人ID
     * @param executor             接收者实验室成员Id
     * @param operatorName         操作人姓名
     * @param experimentTargetName 实验流名称
     */
    public ManagerRemovePlanTemplate(Long labId, Long executorUid, Long executor, String operatorName, String experimentTargetName) {
        super(labId, executorUid);
        super.setType(MessageTypeEnum.ManagerRemovePlan.getValue());
        super.setTitle("计划被移除");
        String content = String.format("<span style='color:#F6AC2D'>%s</span><span>移除了</span>" +
                "<span style='color:#F6AC2D'>%s</span><span>的计划</span>", operatorName, experimentTargetName);
        super.setContent(content);
        super.setAppContent(String.format("%s移除了%s的计划", operatorName, experimentTargetName));
        this.labMemberId = executor;
        this.experimentTargetName = experimentTargetName;
        this.operatorName = operatorName;
    }

    @Override
    public String getJsonData() {
        JSONObject object = new JSONObject();
        object.put("content", appContent);//app推送需必须加入此参数
        return object.toJSONString();
    }
}
